<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2020/6/19
  Time: 10:12
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>客户转移</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/layui/css/layui.css">
</head>
<body>
<form class="layui-form" action="${pageContext.request.contextPath}/customer/transfer" method="post">
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">转移对象</label>
            <div class="layui-input-inline">
                <select name="name"  lay-search="">
                    <option value="">请选择</option>
                    <option value="1">www</option>
                </select>
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">转移到</label>
            <div class="layui-input-inline">
                <select name="type" lay-search="">
                    <option value="">请选择</option>
                    <option value="1">www</option>
                </select>
            </div>
        </div>
    </div>
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">转移原因</label>
        <div class="layui-input-block">
            <textarea placeholder="" class="layui-textarea"></textarea>
        </div>
    </div>
    <div class="layui-form-item">
        <button style="margin-left: 250px" layui-btn-primary lay-submit class="layui-btn" >重置</button>
        <input type="submit" lay-filter="transfer" lay-submit class="layui-btn" value="转移">
    </div>
</form>
<script src="${pageContext.request.contextPath}/static/layui/layui.js" charset="utf-8"></script>
<script>
    layui.use(['layer','form','table','jquery'],function () {
        var layer = layui.layer
            , form = layui.form;
        var table = layui.table;
        var $ = layui.$;
        //表单提交监听
        form.on("submit(transfer)",function (data) {
            console.log(data.field);
            //发起异步请求，新增 data.field 表单数据
            $.post("${pageContext.request.contextPath}/customer/transfers",function (result) {
                if (result.code==0){
                    //刷新父窗口的表格 parent 父窗口对象
                    parent.layui.table.reload("roleTable",{
                        where:{//查询条件
                            params:data.field//会封装到LayRequest中的params中去
                        },
                        page:{
                            curr:1
                        }
                    })
                    //关闭本窗口
                    //当你在iframe页面关闭自身时
                    var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                    parent.layer.close(index); //再执行关闭
                }
                else {
                    layer.msg("数据加载中");
                }
            },"json");
            return false;//阻止表单跳转。如果需要表单跳转，去掉这段即可。
        })
    });
</script>
</body>
</html>
